<template>
  <Header />
  <router-view v-slot="props">
    <component :is="props.Component"></component>
    <button>123</button>
  </router-view>
</template>

<script lang="ts">
import { defineComponent, onMounted, onUnmounted, onUpdated } from "vue";

import { px2Rem } from "./utils/usePxToRem";

import Header from "./components/Header/Header.component.vue";

export default defineComponent({
  name: "App",

  components: { Header },

  setup(props, context) {
    onMounted(() => {
      px2Rem.setRem();
      window.addEventListener("resize", px2Rem.setRem);
    });

    onUnmounted(() => {
      window.removeEventListener("resize", px2Rem.setRem);
    });
  },
});
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;
}

#nav a {
  font-weight: bold;
  color: #2c3e50;
}

#nav a.router-link-exact-active {
  color: #42b983;
}
</style>
